package maze.model.astar;

import java.util.PriorityQueue;

import maze.pojo.Point;


/**
 * @author Shiba Yumeno
 *
 */
class OpenList {
	PriorityQueue<Node> queue = new PriorityQueue<>();

	public void offer(Point point, int score) {
		queue.offer(new Node(point, score));
	}

	public Point poll() {
		return queue.poll().point;
	}

	public boolean isEmpty() {
		return queue.isEmpty();
	}
}

class Node implements Comparable<Node> {
	Point point;

	int score;

	public Node(Point point, int score) {
		this.point = point;
		this.score = score;
	}

	@Override
	public int compareTo(Node n) {
		return n.score - score;
	}
}
